package com.incar.chuxing.activity.personal;

import android.content.Context;
import android.content.Intent;
import android.net.Uri;
import android.support.v7.widget.Toolbar;
import android.view.View;

import com.incar.chuxing.R;
import com.incar.chuxing.base.BaseActivity;
import com.incar.chuxing.utils.AppManager;
import com.incar.chuxing.utils.Dialogs.DialogTwoButton;
import com.incar.chuxing.utils.SPKey;
import com.incar.chuxing.utils.SPUtils;

import butterknife.BindView;
import butterknife.OnClick;

public class ContactServiceActivity extends BaseActivity {
    @BindView(R.id.toolbar)
    Toolbar toolbar;
    private Context mContext = this;

    @Override
    public int getLayoutId() {
        return R.layout.activity_contact_service;
    }

    @Override
    public void initView() {
        toolbar.setNavigationOnClickListener(new View.OnClickListener() {
            @Override
            public void onClick(View v) {
                AppManager.getAppManager().finishActivity();
            }
        });

    }


    @OnClick(R.id.contact_service)
    public void onViewClicked() {
        final DialogTwoButton dialogTwoButton = new DialogTwoButton(mContext);
        dialogTwoButton.setTitle("欢迎致电大道用车客服中心");
        dialogTwoButton.setMessage(SPUtils.getInstance(this).getStringValue(SPKey.HOT_LINE));
        dialogTwoButton.setYesOnclickListener("呼叫", new DialogTwoButton.onYesOnclickListener() {
            @Override
            public void onYesClick() {
                Intent intent = new Intent(Intent.ACTION_DIAL, Uri.parse("tel:" + SPUtils.getInstance(mContext).getStringValue(SPKey.HOT_LINE)));
                intent.setFlags(Intent.FLAG_ACTIVITY_NEW_TASK);
                startActivity(intent);
                dialogTwoButton.dismiss();
            }
        });
        dialogTwoButton.setNoOnclickListener("取消", new DialogTwoButton.onNoOnclickListener() {
            @Override
            public void onNoClick() {
                dialogTwoButton.dismiss();
            }
        });
        dialogTwoButton.show();
    }
}
